package be.tihh.mgmt.gui.icontreenode;

import javax.swing.*;
import java.awt.*;

public class ComputerIcons extends TreeComputerIcon {

    protected String label;

    public static final String PREFIX = "COMPUTER_ICONS_";
    public static final String COMPUTER_STATUS_ON = PREFIX + "COMPUTER_STATUS_ON";
    public static final String COMPUTER_STATUS_OFF = PREFIX + "COMPUTER_STATUS_OFF";
    public static final String COMPUTER_STATUS_UNKNOWN = PREFIX + "COMPUTER_STATUS_UNKNOWN";

    protected ComputerIcons(String type) {
        this.label = type;
    }

    public void paintIcon(Component c, Graphics g, int x, int y) {

        super.paintIcon(c, g, x, y);
        if (COMPUTER_STATUS_ON.equals(label)) {
            // Fill glass portion of monitor
            g.setColor(Color.GREEN);
            g.fillRect(5, 4, 6, 4);
        } else if (COMPUTER_STATUS_OFF.equals(label)) {
            // Fill glass portion of monitor
            g.setColor(Color.RED);
            g.fillRect(5, 4, 6, 4);
        }
    }

    public static Icon getIcon(String type) {
        return new ComputerIcons(type);
    }


}
